package com.gz.logistics.library.pojo;

import org.json.JSONArray;
import org.json.JSONException;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by Administrator on 2016/3/11.
 *
 */
public class Building extends CustomerSpinnerObject {
    private int building_id;

    public String getBuilding_name() {
        return building_name;
    }

    public void setBuilding_name(String building_name) {
        this.building_name = building_name;
    }

    public int getBuilding_id() {
        return building_id;
    }

    public void setBuilding_id(int building_id) {
        this.building_id = building_id;
    }

    private String building_name;
    @Override
    public String toString() {
        return building_name;
    }
    public static List<Building> parse(JSONArray jsonArray) throws JSONException {
        if (jsonArray == null || jsonArray.length() <= 0){
            return null;
        }
        List<Building> buildings = new ArrayList<Building>();
        for (int i = 0 ; i < jsonArray.length() ; i ++ ){
            Building  building = new Building();
            building.building_id = (jsonArray.getJSONObject(i)).getInt("building_id");
            building.building_name = (jsonArray.getJSONObject(i)).getString("building_name");
            buildings.add(building);
        }
        return buildings;
    }
}
